package main

import (
	"fmt"
	"net/http"

	"code.google.com/awwwe-browser/voisedit/editvois"
)

// autostart:
// C:\Users\user1\My Projects\go\src\code.google.com\p\go-tour\gotour\local.go

func main() {
	editvois.SetHostPort("localhost", 9999)
	// html templates
	http.HandleFunc(fmt.Sprintf("/%s/", editvois.Package), editvois.HandlerDefault)
	http.HandleFunc(fmt.Sprintf("/%s/VoisEditor", editvois.Package), editvois.HandlerEditor)
	http.HandleFunc(fmt.Sprintf("/%s/VoisEditing", editvois.Package), editvois.HandlerEditing)

	http.HandleFunc(fmt.Sprintf("/%s/TrueKiss", editvois.Package), editvois.HandlerTrueKiss)
	http.HandleFunc(fmt.Sprintf("/%s/VoisHowTo/VoisLessons", editvois.Package), editvois.HandlerHowToLessons)
	http.HandleFunc(fmt.Sprintf("/%s/VoisHowTo/VoisIntro", editvois.Package), editvois.HandlerHowToIntro)
	http.HandleFunc(fmt.Sprintf("/%s/VoisHowTo/XpathIntro", editvois.Package), editvois.HandlerHowToXpathIntro)
	http.HandleFunc(fmt.Sprintf("/%s/VoisHowTo/ArticleSpaces", editvois.Package), editvois.HandlerHowToArticle)
	http.HandleFunc(fmt.Sprintf("/%s/VoisHowTo/NavigationSpaces", editvois.Package), editvois.HandlerHowToNavigation)
	http.HandleFunc(fmt.Sprintf("/%s/VoisHowTo/FormSpaces", editvois.Package), editvois.HandlerHowToForm)
	// css templates
	http.HandleFunc(fmt.Sprintf("/%s/Styles/Home", editvois.Package), editvois.HandlerHomeCSS)
	http.HandleFunc(fmt.Sprintf("/%s/Styles/NotHome", editvois.Package), editvois.HandlerNotHomeCSS)
	http.HandleFunc(fmt.Sprintf("/%s/Styles/General", editvois.Package), editvois.HandlerGeneralCSS)
	http.HandleFunc(fmt.Sprintf("/%s/Styles/Navigation", editvois.Package), editvois.HandlerNavigationCSS)
	http.HandleFunc(fmt.Sprintf("/%s/Styles/Form", editvois.Package), editvois.HandlerFormCSS)
	// files
	http.Handle("/vois.xml", http.FileServer(http.Dir(".")))
	http.Handle(fmt.Sprintf("/%s/Images/", editvois.Package), http.FileServer(http.Dir(".")))
	http.Handle(fmt.Sprintf("/%s/Javascript/", editvois.Package), http.FileServer(http.Dir(".")))
	http.Handle(fmt.Sprintf("/%s/Styles/VOISEditor.css", editvois.Package), http.FileServer(http.Dir(".")))
	http.ListenAndServe(editvois.HostPort(), nil)
}
